package com.example.demo.message;

import org.apache.activemq.command.ActiveMQQueue;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jms.core.JmsMessagingTemplate;
import org.springframework.stereotype.Component;

import javax.jms.Queue;
import java.util.Map;
import java.util.Scanner;

@Component
public class MessageSender {
    @Autowired(required = false)
    private JmsMessagingTemplate jmsMessagingTemplate;
    /**
     * 发送消息至消息队列.
     * @param mapMessage - Key-Value格式的消息
     */
    public void sendMessage(final Map<String, Object> mapMessage) {
        Queue queue = new ActiveMQQueue("vojSubmissionTaskQueue");
        jmsMessagingTemplate.convertAndSend(queue,mapMessage);
    }

}
